/* UVa- 10189
 * Author- Ajeet Singh
 * http://uva.onlinejudge.org
 * id- ajeet.singh82
 * Contact- ajeet.singh82@gmail.com
 *
 * 
 * Algorithm: 
 *
 *
 * Build:
 * ...
 */
#include <iostream>
#include <iterator> 
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

void process_row(string& r) {
	string::iterator it = r.begin();
	while(it != r.end()) {
		if(*it == '.') *it = '0';
		it++;
	}
	return;
}

void algorithm(vector<string>& ip) {
	vector<string>::iterator i = ip.begin();
	while(i != ip.end()) {
		if(i == ip.begin()) {
			vector<string>::iterator n = i+1;
			size_t pos = i->find('*');
			while(pos != string::npos) {
				if(pos == 0) {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos+1] != '*' ? ((*n)[pos+1])++: (*n)[pos+1];
				} else if(pos == i->size()-1) {
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos-1] != '*' ? ((*n)[pos-1])++: (*n)[pos-1];
				} else {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos+1] != '*' ? ((*n)[pos+1])++: (*n)[pos+1];
					(*n)[pos-1] != '*' ? ((*n)[pos-1])++: (*n)[pos-1];
				}
				pos = i->find('*', pos+1);
			}
		} else if(i+1 == ip.end()) {
			vector<string>::iterator p = i-1;
			size_t pos = i->find('*');
			while(pos != string::npos) {
				if(pos == 0) {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos+1] != '*' ? ((*p)[pos+1])++: (*p)[pos+1];
				} else if(pos == i->size()-1) {
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos-1] != '*' ? ((*p)[pos-1])++: (*p)[pos-1];
				} else {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos+1] != '*' ? ((*p)[pos+1])++: (*p)[pos+1];
					(*p)[pos-1] != '*' ? ((*p)[pos-1])++: (*p)[pos-1];
				}
				pos = i->find('*', pos+1);
			}
		} else {
			vector<string>::iterator p = i-1;
			vector<string>::iterator n = i+1;
			size_t pos = i->find('*');
			while(pos != string::npos) {
				if(pos == 0) {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos+1] != '*' ? ((*p)[pos+1])++: (*p)[pos+1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos+1] != '*' ? ((*n)[pos+1])++: (*n)[pos+1];
				} else if(pos == i->size()-1) {
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos-1] != '*' ? ((*p)[pos-1])++: (*p)[pos-1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos-1] != '*' ? ((*n)[pos-1])++: (*n)[pos-1];
				} else {
					(*i)[pos+1] != '*' ? ((*i)[pos+1])++: (*i)[pos+1];
					(*i)[pos-1] != '*' ? ((*i)[pos-1])++: (*i)[pos-1];
					(*p)[pos] != '*'   ? ((*p)[pos])++  : (*p)[pos];
					(*p)[pos+1] != '*' ? ((*p)[pos+1])++: (*p)[pos+1];
					(*p)[pos-1] != '*' ? ((*p)[pos-1])++: (*p)[pos-1];
					(*n)[pos] != '*'   ? ((*n)[pos])++  : (*n)[pos];
					(*n)[pos+1] != '*' ? ((*n)[pos+1])++: (*n)[pos+1];
					(*n)[pos-1] != '*' ? ((*n)[pos-1])++: (*n)[pos-1];
				}
				pos = i->find('*', pos+1);
			}
		}	
		i++;
	}
	return;
}

/* main
 * */

int main() {
	long fields = 0;
	while ( true ) {
		unsigned long n =0;
		unsigned long m =0;
		vector<string> irows;
		cin >> n >> m;
		if (n == 0 && m == 0) { 
			return 0;
		}
		if(fields != 0) 
			cout << endl;
		fields++;
		string row;
		for (short i = 0; i < n; i++) {
			cin >> row;
			irows.push_back(row);
		}
		for_each(irows.begin(), irows.end(), process_row);
		algorithm(irows);
		cout << "Field #" << fields <<":" << endl;
		copy(irows.begin(), irows.end(), ostream_iterator<string>(cout, "\n"));
	}
}
